 

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
     self.edgesForExtendedLayout = UIRectEdgeNone;
    
    [self ly_setNavBarBarTintColor:LY_Theme_Color];
    [self ly_setNavBarTitleColor:[UIColor whiteColor]];
    [self ly_setNavBarTintColor:[UIColor whiteColor]];
 
    
    self.view.backgroundColor = LY_RGB(245, 245, 245);;
    //适配ios10
    self.automaticallyAdjustsScrollViewInsets = NO;
    //初始化界面
    [self loadUI];
  
 }


#pragma mark——————————收到内存警告
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
    
    //清楚sd的缓存
    [[SDImageCache sharedImageCache] setValue:nil forKey:@"memCache"];
    
    
    
}
#pragma mark————————————————————点击屏幕关闭键盘
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    
    [self.view endEditing:YES];
}


//返回上一个界面
- (void)popVc
{
    [self.navigationController popViewControllerAnimated:YES];
}
//隐藏


- (void)dealloc
{
    
   
    [self.view endEditing:YES];
    

    [[NSNotificationCenter defaultCenter]removeObserver:self];
    
   
}





// cell点击变色
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}
- (void)collectionView:(UICollectionView *)colView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
//    UICollectionViewCell* cell = [colView cellForItemAtIndexPath:indexPath];
    //设置(Highlight)高亮下的颜色
//    [cell setBackgroundColor:LY_RGB(220, 220, 220)];
}

- (void)collectionView:(UICollectionView *)colView  didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell* cell = [colView cellForItemAtIndexPath:indexPath];
    //设置(Nomal)正常状态下的颜色
    [cell setBackgroundColor:[UIColor whiteColor]];
}

#pragma mark————————程序即将离开页面
- (void)viewWillDisappear:(BOOL)animated
{
    
    [super viewWillDisappear:animated];
    [self.view endEditing:YES];
    
}


#pragma mark——————————界面启动时候创建界面代码
- (void)loadUI
{
    
}
 


#pragma mark————————————清除所有View
- (void)cleanAllView
{
    [self.view ly_removeAllSubviews];
}
@end
